package com.oc;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.ObjectChoiceField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.decor.BackgroundFactory;

import com.oc.utils.Style;


class ClaimsMob extends net.rim.device.api.ui.UiApplication 
{
    private Bitmap backgroundBitmap;
    
    public static void main(String[] args)
    {
        ClaimsMob instance = new ClaimsMob();
        instance.enterEventDispatcher();
    }  
    /*
    public HelloWorld() 
    {
    	SalutationScreen screen = new SalutationScreen();
        pushScreen(screen);
    }*/
    
    
    public ClaimsMob()
    {
        //The background image.
        backgroundBitmap = Bitmap.getBitmapResource("img/setup_back.png");
        
        MainScreen mainScreen = new MainScreen(MainScreen.NO_VERTICAL_SCROLLBAR);
        
        VerticalFieldManager vfm = new VerticalFieldManager(VerticalFieldManager.NO_VERTICAL_SCROLL | VerticalFieldManager.NO_VERTICAL_SCROLLBAR |  VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT){
            
            //Override the paint method to draw the background image.
            public void paint(Graphics graphics)
            {
                //Draw the background image and then call paint.
                graphics.drawBitmap(0, 0, 360, 480, backgroundBitmap, 0, 0);
                super.paint(graphics);
            }            
            
        };
        
        BasicEditField fld_nombre = new BasicEditField("","",20,BasicEditField.NO_NEWLINE | BasicEditField.FILTER_DEFAULT);
        fld_nombre.setFont(Style.h2());
        fld_nombre.setMargin(131, 18, 0, 15);
        //fld_nombre.setBackground(BackgroundFactory.createSolidBackground(0x00c0c0c0));
        vfm.add(fld_nombre);  
        
        HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.NO_HORIZONTAL_SCROLL | HorizontalFieldManager.NO_HORIZONTAL_SCROLLBAR | HorizontalFieldManager.FIELD_LEFT);

        String tipos[] = {"DNI", "CI", "LE", "LC"}; 
        ObjectChoiceField fld_tipodoc = new ObjectChoiceField("",tipos,1,Field.FIELD_LEFT);
        fld_tipodoc.setMargin(0, 10, 0,10 );
        hfm.add(fld_tipodoc);
         
     
        BasicEditField fld_numero = new BasicEditField("","",9,BasicEditField.FILTER_NUMERIC | Field.FIELD_LEFT);
        //fld_numero.setBackground(BackgroundFactory.createSolidBackground(0x00c0c0c0));
        fld_numero.setMargin(13, 18, 0,18 );
        fld_numero.setFont(Style.h2());
        hfm.add(fld_numero);
        

        hfm.setMargin(41, 0,0,0 );
        vfm.add(hfm);
        
        
        BasicEditField fld_telefono = new BasicEditField("","",15,BasicEditField.FILTER_PHONE);
        //fld_telefono.setBackground(BackgroundFactory.createSolidBackground(0x00c0c0c0));
        fld_telefono.setMargin(37, 18, 0, 15);
        fld_telefono.setFont(Style.h2());
        //fld_telefono.setBackground(BackgroundFactory.createSolidBackground(0x00c0c0c0));
        vfm.add(fld_telefono);

        //Add the manager to the screen.
        mainScreen.add(vfm);

        //Push the screen.
        pushScreen(mainScreen);
    }
}

